package com.ethink.platform.controller;

import com.ethink.framework.common.util.JacksonUtils;
import com.ethink.warehouse.api.WarehouseOpenapiFacade;
import com.ethink.warehouse.api.component.request.WarehouseEtonbaoCallbackRequest;
import com.ethink.warehouse.api.component.response.WarehouseEtonbaoCallbackResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author: lzy
 * @Date: Created in 2022/11/18 10:54
 * ModifiedBy:
 * Version:
 */
@Tag(name = "OpenapiController", description = "开放接口 Controller")
@RestController
@Slf4j
@RequestMapping("platform-server/v1/openapi")
public class OpenapiController {
    @Autowired
    private WarehouseOpenapiFacade warehouseOpenapiFacade;

    @Operation(summary = "青岛仓易通宝平台通知")
    @PostMapping("/etonbao/callback")
    public WarehouseEtonbaoCallbackResponse etonbaoCallback(@RequestBody String request) {
        return warehouseOpenapiFacade.etonbaoCallback(JacksonUtils.toObj(request, WarehouseEtonbaoCallbackRequest.class));
    }
}
